<%@ page import="cardbs.domain.Department" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; harset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 1.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Εκτέλεση παραγγελίας</title>

<script type="text/javascript">
<!--
var counter = 0;
function more() {
	moreFields();
}

function setVisibility(id, visibility) {
	document.getElementById(id).style.visibility = visibility;
	}
	
function moreFields() {
	counter++;
	var newFields = document.getElementById('readroot').cloneNode(true);
	newFields.id = '';
	newFields.style.display = 'block';
	var newField = newFields.childNodes;
	for (var i=0;i<newField.length;i++) {
		var theName = newField[i].name
		if (theName)
			newField[i].name = theName + counter;
	}
	var insertHere = document.getElementById('writeroot');
	insertHere.parentNode.insertBefore(newFields,insertHere);
}
function validate (id)
{    
	if (document.getElementById(id).value <= 0 )
    {
        alert ("Παρακαλώ δώστε θετική τιμή ποσότητας" );
        
    }
 	
}


window.onload = moreFields;
//-->
</script>

</head>
<body>
<table>
  	<tr>
  		<td width="100%">
  		<td width="45%" width="560">
  		 <input TYPE="button" VALUE="Δημιουργία νέας παραγγελίας" style="width: 193px" onclick="setVisibility('createOrder', 'visible');">
  		</td>
  	</tr>
 </table>
 <div id="createOrder" style="visibility:hidden">
  <h2>Σύνταξη της νέας παραγγελίας</h2>
 <div id="readroot" style="display: none">

	<input type="button" value="Remove review"
		onclick="this.parentNode.parentNode.removeChild(this.parentNode);" /><br /><br />

	<input name="cd" value="title" onchange="alert("Παρακαλώ δώστε θετική τιμή ποσότητας")"/>

	<select name="rankingsel">
		<option>Rating</option>
		<option value="excellent">Excellent</option>
		<option value="good">Good</option>
		<option value="ok">OK</option>
		<option value="poor">Poor</option>
		<option value="bad">Bad</option>
	</select><br /><br />

	<textarea rows="5" cols="20" name="review">Short review</textarea>
	<br />Radio buttons included to test them in Explorer:<br />
	<input type="radio" name="something" value="test1" />Test 1<br />
	<input type="radio" name="something" value="test2" />Test 2

</div>
<form method="post" action="/car-dbs-implementation/InsertOrderInfoServlet">
	<span id="writeroot"></span>
<input name="cd2" value="title" onchange="alert("Παρακαλώ δώστε θετική τιμή ποσότητας")"/>
	<input type="button" id="moreFields" value="Give me more fields!" onclick="more()"/>
	<input type="submit" value="Send form" />

</form>
</div>
</body>
</html>